package apis

import (
	"first-gin/common"
	"github.com/gin-gonic/gin"
)

type OrderController struct{}

func (o OrderController) GetList(c *gin.Context) {
	cid := c.PostForm("pid")
	name := c.PostForm("name")
	common.ReturnSuccess(c, "用户信息", "ID:"+cid+"用户名称:"+name)
}

func (o OrderController) GetListByMap(c *gin.Context) {
	param := make(map[string]interface{})
	e := c.BindJSON(&param)
	if e == nil {
		common.ReturnSuccess(c, "ok", param)
		return
	}
	common.ReturnError(c, "error")

}

type Search struct {
	Name string `form:"name"`
	Cid  string `form:"cid"`
}

func (o OrderController) GetListByStruct(c *gin.Context) {
	search := &Search{}
	e := c.BindJSON(&search)
	if e == nil {
		common.ReturnSuccess(c, "ok", search)
		return
	}
	common.ReturnError(c, "error")

}
